AS=nasm
CC=gcc
LD=ld
OBJ=objcopy

ASFLAGS=-felf
CCFLAGS=-I./include -fno-stack-protector
LDFLAGS=-T./link.ld
OBJFLAGS=-R .pdr -R .comment -R .note -S -O binary

all: kernel.com

kernel.com: load.bin kernel.bin
	cat load.bin kernel.bin > kernel.com

kernel.bin: start.asm kernel.c put_func.c
	$(AS) $(ASFLAGS) -o start.elf start.asm
	$(CC) $(CCFLAGS) -c *.c
	$(LD) $(LDFLAGS) -o kernel.x *.elf *.o
	$(OBJ) $(OBJFLAGS)  kernel.x kernel.bin

load.bin: load.asm 
	$(AS) -o load.bin load.asm

clean:
	rm -rf *.elf *.bin *.o *.x *.com
